<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>认识正则表达式</title>
    <script type="text/javascript">
        var reg=/apple/i;
        var arr=reg.exec("Hello Apple");
        console.log(arr);
        console.log(arr[0]);
        console.log(arr.index);
        //match()方法
        var reg1=/apple/gi;
        var str="Hello Apple apple";
        var arr1=str.match(reg1);
        console.log(arr1);
        for (var i in arr1){
            console.log(arr1[i]);
        }
        var reg2=/^apple
        var arr2=str.match()
    </script>
</head>
<body>

</body>
</html>